package com.wjw.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.wjw.mapper.OrderMapper;
import com.wjw.pojo.MainMenu;
import com.wjw.pojo.Order;
import com.wjw.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order>implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Override
    public PageInfo<Order> listMyOrders(Integer userId, String bookName) {
        List<Order>list=orderMapper.listMyOrders(userId,bookName);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<Order> myCart(Integer userId) {
        List<Order>list=orderMapper.cart(userId);
        return new PageInfo<>(list);
    }

    @Override
    public int payOrder(Integer userId) {
        return orderMapper.payOrder(userId);
    }

    @Override
    public PageInfo<Order> listMySale(String  userName, String bookName) {
        List<Order>list=orderMapper.listMySale(userName,bookName);
        return new PageInfo<>(list);
    }

    @Override
    public List<MainMenu> queryAll() {
        return orderMapper.queryAll();
    }

    @Override
    public PageInfo<Order> listOrder(Integer id) {
        List<Order>list=orderMapper.listOrders(id);
        return new PageInfo<>(list);
    }
}
